<?php


// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view' );


class ShopViewGoods extends JView
{
	function display($tpl = null)
	{
		JToolBarHelper::title(JText::_( 'Список товаров' ), 'generic.png');
		JToolBarHelper::addNewX('addGood','Добавить');
		JToolBarHelper::editListX('editGood','Изменить');
		JToolBarHelper::deleteListX('Вы уверены что хотите удалить выбранные товары ?','delGood');
    	
		// Get data from the model
		//$model =& $this->getModel();
		$items	=  $this->get('Data');
		$page = JRequest::getInt('page',1);
		$cat_id = JRequest::getInt('cat_id');
		//echo $page;
		if($page<=0)
			$page=1;
		$db = &JFactory::getDBO();
		
		$number = $this->get('Pages');
		$number_of_page = ceil($number/30);
		
		
		$query = "SELECT name,id FROM #__shop_categories ORDER BY ordering ASC";
		$db->setQuery($query);
		$categories = $db->loadObjectList();
		
		$this->assignRef('page',$page);
		$this->assignRef('cat_id',$cat_id);
		$this->assignRef('pages',$number_of_page);
		$this->assignRef('categories',$categories);
		$this->assignRef('items',$items);
		

		parent::display($tpl);
	}
}
?>